package ua.pp.bizon.cripto.utils;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

public class FtpConfig {

    private String url;
    private String pass;
    private String login;

    public static FtpConfig readConfig(String name) throws IOException {
        Properties p = new Properties();
        p.load(new FileInputStream(new File("ftp.properties").exists() ? new File("ftp.properties") : new File("src/test/resources/ftp.properties")));
        return new FtpConfig(p.getProperty(name + ".url"), p.getProperty(name + ".password"), p.getProperty(name + ".login"));
    }

    private FtpConfig(String url, String pass, String login) {
        super();
        this.url = url;
        this.pass = pass;
        this.login = login;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getPass() {
        return pass;
    }

    public void setPass(String pass) {
        this.pass = pass;
    }

    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    @Override
    public String toString() {
        return "Config [url=" + url + ", login=" + login + "]";
    }

}
